#include <event.h>
#include <time.h>
#include <signal.h>
struct event *ev;
struct timeval tv;

void timer_cb(int fd, short event, void *arg)    //callback函数
{
        printf("timer_cb\n");
        //event_add(ev, &tv);    //重新注册事件
}

int main()
{
	event_init(); //初始化
  	struct event_base *base = event_base_new(); //创建event_base对象  
  	tv.tv_sec = 1;
	tv.tv_usec = 0;  
	ev = event_new(base, -1, EV_READ|EV_PERSIST, timer_cb, NULL); //创建event对象
	event_add(ev, &tv);  //将event添加到events事件链表，注册事件
	event_base_dispatch(base);  //循环、分发事件        
	return 0;
}

